<template>
	<div>
		<div v-for="item in info" :key = "item.id">
			<h3>{{item.title}}</h3>
			<div>{{item.content}}</div>
		</div>
	</div>
</template>

<script>
	export default({
		data(){
			return {
				info:[],
				id:this.$route.params.id
			}
		},
		created(){
			this.getDet()
		},
		methods:{
			getDet(){
				this.$http.get('http://localhost:3002/goodslist').then(result=>{
						if(result.body.status==0){
						let arr=[]
						//定义res用来接收循环message
						arr = result.body.message
						for (let index in arr) {
							if(arr[index].id == this.id){
								this.info.push(arr[index])
							}
						}
					}
				})
			}
		}
	})
</script>

<style scpoed>
</style>
